package com.yjz.demo.tab

import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.yjz.demo.R
import com.yjz.ui.tab.bottom.TabBottomView
import com.yjz.ui.tab.common.TabInfo

/**
 * 作用 : 单个tab演示
 * 作者 : yjz
 * 时间 : 2024/9/18 14:30
 */
class BottomTabActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_bottom_tab)
        val tabBottomView = findViewById<TabBottomView>(R.id.tab_bottom)
        // 文字图标
        val iconFontTabInfo = TabInfo(
            "首页", "fonts/iconfont.ttf",
            getString(R.string.if_home), "",
            "#000000", "#ffff00"
        )
        // 单图片
        val bitmapTabInfo = TabInfo<String>(
            "首页",
            BitmapFactory.decodeResource(resources, R.drawable.home_normal),
            BitmapFactory.decodeResource(resources, R.drawable.home_select)
        )
        // 图片+文字
        val bitmapTxtTabInfo = TabInfo(
            "首页",
            BitmapFactory.decodeResource(resources, R.drawable.home_normal),
            BitmapFactory.decodeResource(resources, R.drawable.home_select),
            "#000000", "#ffff00"
        )
        tabBottomView.setTabDataInfo(bitmapTabInfo)
    }
}
